<%@ page import="com.mapper.DeliverymanMapper" %>
<%@ page import="com.Imp.DeliverymanMapperImpl" %>
<%@ page import="com.entity.Deliveryman" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>页面布局</title>
    <!-- 新 Bootstrap5 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css">

    <!--  popper.min.js 用于弹窗、提示、下拉菜单 -->
    <script src="https://cdn.staticfile.org/popper.js/2.9.3/umd/popper.min.js"></script>

    <!-- 最新的 Bootstrap5 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/js/bootstrap.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/main.css">
    <link rel="stylesheet" type="text/css" href="./css/information_customer.css">
</head>
<body>
<%
    String userName = (String) session.getAttribute("username");
    DeliverymanMapper deliverymanMapper = new DeliverymanMapperImpl();
    Deliveryman deliveryman = deliverymanMapper.getDeliverymanByUserName(userName);
%>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-12 header" style="background-color: black">
            <h1>外卖员</h1>
        </div>
    </div>

    <!-- 模态框 -->
    <div class="modal" id="myModal">
        <div class="modal-dialog">
            <div class="modal-content">
                <!-- 模态框头部 -->
                <div class="modal-header">
                    <h4 class="modal-title">编辑个人资料</h4>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <!-- 模态框内容 -->
                <div class="modal-body">
                    <form action="DeliverymanController?op=change" method="post">
                        <div class="input-group mb-4">
                            <span class="mt-2">用户名：</span>
                            <input type="text" class="form-control" name="name" placeholder="输入用户名">
                        </div>
                        <div class="input-group mb-4">
                            <span class="mt-2">性别：</span>
                            <select class="form-select" name="gender">
                                <option value="男">男</option>
                                <option value="女">女</option>
                            </select>
                        </div>
                        <div class="input-group mb-4">
                            <span class="mt-2">年龄：</span>
                            <input type="text" class="form-control" name="age" placeholder="输入年龄">
                        </div>
                        <div class="input-group mb-4">
                            <span class="mt-2">手机号：</span>
                            <input type="text" class="form-control" name="phoneNumber" placeholder="输入手机号">
                        </div>
                        <div class="modal-footer">
                        <button type="submit" class="btn btn-success">提交</button>
                        <button type="button" class="btn btn-danger" data-bs-dismiss="modal">关闭</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-2 sidebar">
            <div class="sidebar-menu">
                <ul>
                    <li><a href="main_deliveryman.jsp"><img src="img/main.png" height="18" width="18">&nbsp首页</a></li>
                    <li><a href="orderInformation.jsp"><img src="img/waimai.png" height="18" width="18">&nbsp配送单管理</a></li>
                    <li class="active"><a href="information_deliveryman.jsp" style="background-color: #55aaff"><img src="img/personal.png" height="18" width="18">&nbsp个人信息</a></li>
                </ul>
            </div>
        </div>

        <div class="col-md-10 main-content">
            <div v-for="store in stores" :key="store.id" class="store-info">

                <div class="bg-white">
                    <div class="developer-toolbag-block">
                        <div class="titleBar">
                            <h3 class="caption">个人中心</h3>
                        </div>
                        <%
                            if(deliveryman != null){
                        %>
                        <div class="AGrid-row  tool-package">
                            <div class="col-sm-6 ">
                                <div class="tile center-layer">
                                    <div class="layer-figure">
                                        <img src="img/yonghu.png" height="20" width="20">
                                    </div>
                                    <h2 class="dev-list">用户名</h2>
                                    <div class="layer-text">
                                        <h1 class="">
                                            <%=deliveryman.getName()%>
                                        </h1>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 ">
                                <div class="tile center-layer">
                                    <div class="layer-figure">
                                        <img src="img/zhanghao.png" height="20" width="20">
                                    </div>
                                    <h2 class="dev-list">账号</h2>
                                    <div class="layer-text">
                                        <h1 class=" ">
                                            <%=deliveryman.getUserName()%>
                                        </h1>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 ">
                                <div class="tile center-layer">
                                    <div class="layer-figure">
                                        <img src="img/xingbie.png" height="20" width="20">
                                    </div>
                                    <h2 class="dev-list">性别</h2>
                                    <div class="layer-text">
                                        <h1 class=" ">
                                            <%=deliveryman.getSex()%>
                                        </h1>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 ">
                                <div class="tile center-layer">
                                    <div class="layer-figure">
                                        <img src="img/nianling.png" height="20" width="20">
                                    </div>
                                    <h2 class="dev-list">年龄</h2>
                                    <div class="layer-text">
                                        <h1 class=" ">
                                            <%=deliveryman.getAge()%>
                                        </h1>
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6 ">
                                <div class="tile center-layer">
                                    <div class="layer-figure">
                                        <img src="img/shoujihao.png" height="20" width="20">
                                    </div>
                                    <h2 class="dev-list">手机号</h2>

                                    <div class="layer-text">
                                        <h1 class=" ">
                                            <%=deliveryman.getPhone()%>
                                        </h1>
                                    </div>
                                </div>
                            </div>
                            <%
                            }
                            else {
                            %>
                            <div class="col-sm-6 ">
                                <div class="tile center-layer">
                                    <div class="layer-figure">
                                        <img src="./img/DevCloud-TestMan.png">
                                    </div>
                                    <div class="layer-text">
                                        <h1 class=" ">
                                            还没有个人信息？快快编辑！
                                        </h1>
                                    </div>
                                </div>
                            </div>
                            <%
                                }
                            %>

                        </div>
                        <button type="button" class="btn btn-primary " data-bs-toggle="modal" data-bs-target="#myModal">
                            编辑资料
                        </button>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

</body>
</html>
